package com.yequan.work;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yequan
 * @date 2021/04/09 22:33
 **/
public class ListDemo {

    public static void main(String[] args) {
//        coupons();
        list();
    }

    public static void list(){
        List<Integer> userIds = new ArrayList<>();
        userIds.add(1);
        userIds.add(2);
        userIds.add(3);
        userIds.addAll(null);
        System.out.println(userIds);
    }

    public static void coupons() {
        List<Coupon> couponList = new ArrayList<>();

        couponList.add(new Coupon("a", "1"));
        couponList.add(new Coupon("b", "2"));

        System.out.println("before===>" + JsonMapper.toJson(couponList));

        Coupon coupon1 = couponList.get(0);
        Coupon coupon2 = couponList.get(1);

        Coupon temp = null;
        temp = coupon1;
        coupon1 = coupon2;
        coupon2 = temp;

        couponList.set(0, coupon1);
        couponList.set(1, coupon2);

        System.out.println("after===>" + JsonMapper.toJson(couponList));
    }

}
